import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '@/views/home/index.vue'
import gedan from '@/views/gedan/gedan.vue'
import jingpin from '@/views/gedan/components/jingpin.vue'
import tuijian from '@/views/gedan/components/tuijian.vue'
import oumei from '@/views/gedan/components/oumei.vue'
import dianzi from '@/views/gedan/components/dianzi.vue'
import hanyu from '@/views/gedan/components/hanyu.vue'
import minyao from '@/views/gedan/components/minyao.vue'
import qingyinyue from '@/views/gedan/components/qingyinyue.vue'
import paihang from '@/views/paihang/paihang.vue'
import song from '@/views/song/index.vue'
import search from '@/views/search/index'
import hotList from '@/views/search/components/hotList'
import seardata from '@/views/search/components/seardata'
import phone from '@/views/login/phone'
import pwd from '@/views/login/pwd'
import vd from '@/views/login/vd'

// 点击
Vue.use(VueRouter)
const routes = [{
  path: '/',
  name: 'index',
  component: index
},
{
  path: '/gedan',
  name: 'gedan',
  component: gedan,
  redirect: {
    name: 'tuijian'
  }, // 路由重定向  //子路由path不需要 '/'
  children: [{
    path: 'tuijian',
    name: 'tuijian',
    component: tuijian
  }, {
    path: 'jingpin',
    name: 'jingpin',
    component: jingpin
  }, {
    path: 'oumei',
    name: 'oumei',
    component: oumei
  }, {
    path: 'dianzi',
    name: 'dianzi',
    component: dianzi
  }, {
    path: 'hanyu',
    name: 'hanyu',
    component: hanyu
  }, {
    path: 'minyao',
    name: 'minyao',
    component: minyao
  }, {
    path: 'qingyinyue',
    name: 'qingyinyue',
    component: qingyinyue
  }]
}, {
  path: '/paihang',
  name: 'paihang',
  component: paihang
}, {
  path: '/song',
  name: 'song',
  component: song
}, {
  path: '/search',
  name: 'search',
  component: search,
  redirect: { name: 'hotList' },
  children: [{
    path: '',
    name: 'hotList',
    component: hotList
  }, {
    path: 'site',
    name: 'site',
    component: seardata
  }]
}, {
  path: '/phone',
  name: 'phone',
  component: phone
}, {
  path: '/pwd',
  name: 'pwd',
  component: pwd
}, {
  path: '/vd',
  name: 'vd',
  component: vd
}]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})
export default router
